package sso.resource.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import sso.resource.interceptor.TokenInterceptor;

/**
 * 定义SpringMVC配置类
 */
@Configuration
public class SpringWebConfig implements WebMvcConfigurer {
    //将拦截器添加到spring mvc的执行链中,此对象添加了一个list集合
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new TokenInterceptor())
                //控制要拦截的URL
                .addPathPatterns("/**");
    }
}
